

import UIKit

//MARK: - 空页面展示类型
enum GameEmptyState {
    
    case noList
    case noMessage
    case noInternet

    var image: UIImage? {
        switch self {
        case .noList: return UIImage(named: "nolist")
        case .noMessage: return UIImage(named: "nomessage")
        case .noInternet: return UIImage(named: "nointnet")
        }
    }
    
    var title: String? {
        switch self {
        case .noList: return ""
        case .noMessage: return ""
        case .noInternet: return ""
        }
    }
    
    var description: String? {
        switch self {
        case .noList: return "No content"
        case .noMessage: return "No news yet"
        case .noInternet: return "Network anomaly!"
        }
    }
    
    var titleButton: String? {
        switch self {
        case .noList: return ""
        case .noMessage: return ""
        case .noInternet: return ""
        }
    }
}

extension UIView {
    
    func emptyGameView(_ type: GameEmptyState,isDebug:Bool = false) {
        if let scrollView = self as? UIScrollView {
            scrollView.emkk.emptyView = KKEmptyView.empty(firstReloadHidden: false, space: 20.Fit, deploy: { config in
                config.imageSize = CGSize(width: 130.Fit, height: 130.Fit)
                config.image = type.image
                config.title = type.description
                config.titleFont = UIFont.setTypeFace(14, type: .medium)
                config.titleColor = titleColor
            }, closure: { tag in

            })
        }
    }
    
}
